Fix a relative `rustc` spec to .cargo/config
authorAlex Crichton <alex@alexcrichton.com>
Wed, 20 May 2015 04:43:41 +0000 (21:43 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Wed, 20 May 2015 04:43:41 +0000 (21:43 -0700)
The paths were mistakenly relative to .cargo/config, not the directory
containing .cargo/config

src/cargo/util/config.rs

index 65f119bae22de00b87d0ff30423870bf93ee6486..7681bc0cbffd7a3b8b56ca741b5f67e3d0422ce5 100644 (file)
@@ -209,7 +209,12 @@ impl Config {
     fn get_tool(&self, tool: &str) -> CargoResult<PathBuf> {
         let var = format!("build.{}", tool);
         if let Some((tool, path)) = try!(self.get_string(&var)) {
+            // If this tool has a path separator in it, calculate the path
+            // relative to the config file (specified by `path`). To do that we
+            // chop off the `.cargo/config` at the end of the path and then join
+            // on the tool.
             if tool.contains("/") || (cfg!(windows) && tool.contains("\\")) {
+                let path = path.parent().unwrap().parent().unwrap();
                 return Ok(path.join(tool))
             }
             return Ok(PathBuf::from(tool))